package LeetCode.Simple;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/*
从数组中查找重复的数
输入:[2,3,1,0,2,5,3]
输出:2或者3

 */

//弥补知识:数组的三种定义方式

public class Question001 {
    public static void main(String[] args) {
        int []nums = {2,3,1,0,2,5,3};
        new Question001().findRepeatNumber(nums);
        int []a = new int[3];
        int []a1 = {1,2,3,4,5,6};
        int []a2 = new int[]{1,2,3,4,5};
    }

    public int findRepeatNumber(int[] nums){
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < nums.length; i++) {
            if(!set.add(nums[i])){
                System.out.print(nums[i]);
            }
        }
        return 0;
    }
}
